package com.qf.mybatisplus.function.factory;


import com.qf.mybatisplus.exception.customException.BusinessErrorException;
import com.qf.mybatisplus.exception.exceptioConstance.BusinessMsgEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @description: TODO
 * @projectName: mybatisplus
 * @package: com.qf.mybatisplus.function.factory
 * @className: Test
 * @author: zdd
 * @date: 2023/11/29 上午10:20
 * @version: 1.0
 */
@Service
public class FruitService {

    @Autowired
    Map<String,FactoryApi> fruitMap;

    public String getFruitName(String fruit){
        FactoryApi factoryApi = fruitMap.get(fruit);
        if (factoryApi == null){
            throw new BusinessErrorException(BusinessMsgEnum.PARMETER_EXCEPTION);
        }
        String fruitName = factoryApi.getFruitName(fruit);
        return fruitName;
    }


}
